package com.jtjrenren.android.taxi.passenger.manger.pay.ali;

import android.app.Activity;

import com.alipay.sdk.app.PayTask;
import com.jtjrenren.android.taxi.passenger.bean.event.AliPayEvent;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by Administrator on 2016/3/18.
 */
public class AliPayManger {
    public void pay2(final Activity activity, final String payInfo) {
        Runnable payRunnable = new Runnable() {

            @Override
            public void run() {
                // 构造PayTask 对象
                PayTask alipay = new PayTask(activity);
                // 调用支付接口，获取支付结果
                String result = alipay.pay(payInfo, true);

                EventBus.getDefault().post(new AliPayEvent(result));
            }
        };

        // 必须异步调用
        Thread payThread = new Thread(payRunnable);
        payThread.start();
    }
}
